import {
  queryCategory,
  updateCategory,
  queryCategoryById,
  deleteCategory,
  updateCategoryStatus,
  updateCategoryStatusMuilt,
  deleteCategoryMuilt,
  addCategory
} from '@/api/category.js'
export default {
  data() {
    return {
      queryObj: {
        pageSize: 10,
        pageNum: 1,
        title: '',
        status: ''
      },
      buttonsObj: {
        add: 'addCategory',
        update: 'updateCategory',
        enable: 'enableCategory',
        disable: 'disableCategory',
        delete: 'deleteCategory',
        deleteMuilty: 'deleteCategoryMuilty',
        disbleMuilty: 'disableCategoryMuilty',
        enableMuilty: 'enableCategoryMuilty'
      },
      ids: [],
      toastTitle: '课程分类',
      rules: {
        sortNum: [
          {
            required: true,
            message: '请输入排序号',
            trigger: 'blur'
          }
        ],
        title: [
          {
            required: true,
            message: '请输入名称',
            trigger: 'blur'
          }
        ]
      },
      formObj: {
        id: '',
        title: '',
        sortNum: 1
      },
      statusList: [
        {
          status: 0,
          name: '启用'
        },
        {
          status: 1,
          name: '禁用'
        }
      ],
      showList: [
        {
          showIs: 0,
          name: '否'
        },
        {
          showIs: 1,
          name: '是'
        }
      ],
      tableHeader: [
        {
          label: '排序号',
          prop: 'sortNum',
          align: 'center',
          width: '100px'
        },
        {
          label: '名称',
          prop: 'title'
        },
        {
          label: '状态',
          prop: 'status'
        },
        {
          label: '最后修改时间',
          prop: 'lastModifyTime'
        },
        {
          label: '操作',
          prop: 'operation'
        }
      ],
      addApi: addCategory,
      deleteApi: deleteCategory,
      updateApi: updateCategory,
      queryApi: queryCategory,
      updateStatusApi: updateCategoryStatus,
      queryByIdApi: queryCategoryById,
      updateStatusMuiltApi: updateCategoryStatusMuilt,
      deleteMuiltApi: deleteCategoryMuilt
    }
  }
}
